home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update19.zoo / gcc2.1 / gcc-21.diff < prev    next >
Encoding:
Text File  |  1992-03-28  |  54.3 KB  |  2,066 lines

  1. *** 1.3    1992/03/27 21:49:26
  2. --- c-aux-info.c    1992/03/28 01:56:54
  3. ***************
  4. *** 60,66 ****
  5.      BSD systems) now provides getcwd as called for by POSIX.  Allow for
  6.      the few exceptions to the general rule here.  */
  7.   
  8. ! #if !(defined (USG) || defined (VMS))
  9.   extern char *getwd ();
  10.   #define getcwd(buf,len) getwd(buf)
  11.   #define GUESSPATHLEN (MAXPATHLEN + 1)
  12. --- 60,66 ----
  13.      BSD systems) now provides getcwd as called for by POSIX.  Allow for
  14.      the few exceptions to the general rule here.  */
  15.   
  16. ! #if !(defined (USG) || defined (VMS) || defined(CROSSHPUX))
  17.   extern char *getwd ();
  18.   #define getcwd(buf,len) getwd(buf)
  19.   #define GUESSPATHLEN (MAXPATHLEN + 1)
  20. *** 1.3    1992/03/27 21:49:26
  21. --- c-decl.c    1992/03/28 01:58:02
  22. ***************
  23. *** 5388,5393 ****
  24. --- 5388,5395 ----
  25.   
  26.     expand_function_start (fndecl, 0);
  27.   
  28. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  29. +   /* we will only need this in cp-decl.c, not here */
  30.     /* If this function is `main', emit a call to `__main'
  31.        to run global initializers, etc.  */
  32.     if (DECL_NAME (fndecl)
  33. ***************
  34. *** 5394,5399 ****
  35. --- 5396,5402 ----
  36.         && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
  37.         && DECL_CONTEXT (fndecl) == NULL_TREE)
  38.       expand_main_function ();
  39. + #endif
  40.   }
  41.   
  42.   /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
  43. *** 1.3    1992/03/27 21:49:26
  44. --- cccp.c    1992/03/28 01:53:14
  45. ***************
  46. *** 58,63 ****
  47. --- 58,65 ----
  48.   #undef bzero
  49.   #undef bcmp
  50.   
  51. + #ifndef atarist
  52.   #include <sys/types.h>
  53.   #include <sys/stat.h>
  54.   #include <ctype.h>
  55. ***************
  56. *** 66,85 ****
  57.   
  58.   #ifndef VMS
  59.   #include <sys/file.h>
  60. ! #ifndef USG
  61.   #include <sys/time.h>        /* for __DATE__ and __TIME__ */
  62.   #include <sys/resource.h>
  63.   #else
  64.   #define index strchr
  65.   #define rindex strrchr
  66.   #include <time.h>
  67.   #include <fcntl.h>
  68. ! #endif /* USG */
  69.   #endif /* not VMS */
  70. -   
  71.   extern char *index ();
  72.   extern char *rindex ();
  73.   
  74.   /* VMS-specific definitions */
  75.   #ifdef VMS
  76.   #include <time.h>
  77. --- 68,105 ----
  78.   
  79.   #ifndef VMS
  80.   #include <sys/file.h>
  81. ! #if (!(defined(USG) || defined(atariminix)))
  82.   #include <sys/time.h>        /* for __DATE__ and __TIME__ */
  83.   #include <sys/resource.h>
  84.   #else
  85. + #ifndef atariminix
  86.   #define index strchr
  87.   #define rindex strrchr
  88. + #endif
  89.   #include <time.h>
  90.   #include <fcntl.h>
  91. ! #endif /* USG or atariminix */
  92.   #endif /* not VMS */
  93.   extern char *index ();
  94.   extern char *rindex ();
  95.   
  96. + #else    /* atarist */
  97. + #include <ctype.h>
  98. + #include <stdio.h>
  99. + #include <types.h>
  100. + #include <stat.h>
  101. + #include <file.h>
  102. + #include <time.h>
  103. + #include <string.h>
  104. + #include "stddef.h"
  105. + long _stksize = -1L;    /* want big stack cause include files
  106. +                    get alloca'ed there */
  107. + #endif        /* atarist */
  108. +   
  109.   /* VMS-specific definitions */
  110.   #ifdef VMS
  111.   #include <time.h>
  112. ***************
  113. *** 852,858 ****
  114. --- 872,932 ----
  115.   /* Nonzero means -I- has been seen,
  116.      so don't look for #include "foo" the source-file directory.  */
  117.   static int ignore_srcdir;
  118. +  
  119. + #ifdef atarist
  120. + /* a little frobule to filter incoming file data */
  121. + int eunuchs_read(f, buf, size)
  122. + int f;
  123. + char * buf;
  124. + int size;
  125. + {
  126. +     char local_buf[1024];
  127. +     register int result_size;
  128. +     register char * local_bufp, * target_bufp;
  129. +     register int buf_size, size_read;
  130. +     
  131. +     for (result_size = 0, target_bufp = buf ; size > 0 ; size -= 1024)
  132. +     { /* do a buffer */
  133. +     if (size > 1024)
  134. +         buf_size = 1024;
  135. +     else
  136. +         buf_size = size;
  137. +     size_read = read(f, &local_buf, buf_size);
  138. +     for (local_bufp = (char * ) &local_buf; size_read > 0 ; size_read--)
  139. +         if (*local_bufp == '\r')
  140. +         local_bufp++;
  141. +         else
  142. +         {
  143. +         *target_bufp++ = *local_bufp++;
  144. +         result_size++;
  145. +         }
  146. +     }
  147. +     return(result_size);
  148. + }
  149. + /* the following dingus is used in place of some calls to bcopy,
  150. +    to ensure that backslashes get properly slashified when getting
  151. +    shoved into strings.  Note that it returns the new pointer!!
  152. +    There ought to be a better way... */
  153. + U_CHAR * slashifying_bcopy(from_buf, to_buf, nbytes)
  154. + U_CHAR * from_buf, * to_buf;
  155. + int nbytes;
  156. + {
  157. +   for ( ; nbytes > 0 ; )
  158. +     {
  159. +     if(*from_buf == '\\')
  160. +         *to_buf++ = '\\';
  161. +     *to_buf++ = *from_buf++;
  162. +     nbytes--;
  163. +     }
  164. +   return(to_buf);
  165. + }
  166. + #define read(a, b, c) eunuchs_read(a, b, c)
  167. + #endif        /* atarist */
  168.   
  169. + #ifndef atarist
  170.   /* Handler for SIGPIPE.  */
  171.   
  172.   static void
  173. ***************
  174. *** 862,867 ****
  175. --- 936,942 ----
  176.   {
  177.     fatal ("output pipe has been closed");
  178.   }
  179. + #endif /* atarist */
  180.   
  181.   int
  182.   main (argc, argv)
  183. ***************
  184. *** 896,901 ****
  185. --- 971,981 ----
  186.     /* Target-name to write with the dependency information.  */
  187.     char *deps_target = 0;
  188.   
  189. + #ifdef atarist
  190. + /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  191. + /*  _malloczero(1); */     /* zero mallocs by default */
  192. + #endif  
  193.   #ifdef RLIMIT_STACK
  194.     /* Get rid of any avoidable limit on stack size.  */
  195.     {
  196. ***************
  197. *** 944,949 ****
  198. --- 1024,1030 ----
  199.     signal (SIGPIPE, pipe_closed);
  200.   #endif
  201.   
  202. + #ifndef atarist
  203.     for (i = 0; include_defaults[i].fname; i++)
  204.       max_include_len = MAX (max_include_len,
  205.                  strlen (include_defaults[i].fname));
  206. ***************
  207. *** 951,957 ****
  208.   #ifdef VMS
  209.     max_include_len += 10;
  210.   #endif
  211.     bzero (pend_files, argc * sizeof (char *));
  212.     bzero (pend_defs, argc * sizeof (char *));
  213.     bzero (pend_undefs, argc * sizeof (char *));
  214. --- 1032,1041 ----
  215.   #ifdef VMS
  216.     max_include_len += 10;
  217.   #endif
  218. ! #else
  219. !   max_include_len = 80;    /* arbitrary value */
  220. ! #endif
  221. !   
  222.     bzero (pend_files, argc * sizeof (char *));
  223.     bzero (pend_defs, argc * sizeof (char *));
  224.     bzero (pend_undefs, argc * sizeof (char *));
  225. ***************
  226. *** 1154,1163 ****
  227. --- 1238,1253 ----
  228.       break;
  229.   
  230.         case 'v':
  231. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  232. + #include "PatchLev.h"
  233. +     fprintf (stderr, "GNU CPP-atariST version %s Patchlevel %s",
  234. +          version_string, PatchLevel);
  235. + #else
  236.       fprintf (stderr, "GNU CPP version %s", version_string);
  237.   #ifdef TARGET_VERSION
  238.       TARGET_VERSION;
  239.   #endif
  240. + #endif
  241.       fprintf (stderr, "\n");
  242.       break;
  243.   
  244. ***************
  245. *** 1291,1296 ****
  246. --- 1381,1387 ----
  247.       }
  248.     }
  249.   
  250. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  251.     /* Add dirs from CPATH after dirs from -I.  */
  252.     /* There seems to be confusion about what CPATH should do,
  253.        so for the moment it is not documented.  */
  254. ***************
  255. *** 1300,1305 ****
  256. --- 1391,1397 ----
  257.     p = (char *) getenv ("CPATH");
  258.     if (p != 0 && ! no_standard_includes)
  259.       path_include (p);
  260. + #endif
  261.   
  262.     /* Now that dollars_in_ident is known, initialize is_idchar.  */
  263.     initialize_char_syntax ();
  264. ***************
  265. *** 1423,1430 ****
  266.     { /* read the appropriate environment variable and if it exists
  267.          replace include_defaults with the listed path. */
  268.       char *epath = 0;
  269.       switch ((objc << 1) + cplusplus)
  270. !       {
  271.         case 0:
  272.       epath = getenv ("C_INCLUDE_PATH");
  273.       break;
  274. --- 1515,1560 ----
  275.     { /* read the appropriate environment variable and if it exists
  276.          replace include_defaults with the listed path. */
  277.       char *epath = 0;
  278. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  279. +     char *e1 = getenv("GNUINC"), *e2 = getenv("GNULIB"),
  280. +          *e3 = getenv("GXXINC");
  281. +     if(cplusplus)
  282. +     {
  283. +     if(e3)
  284. +         epath = strcpy(alloca(strlen(e3)+1), e3);
  285. +     }
  286. +     if(e1)
  287. +     {
  288. +       if(epath)
  289. +     epath = strcat(
  290. + #ifdef atarist
  291. +      strcat(strcpy(alloca(strlen(epath)+strlen(e1)+2), epath), ","),
  292. +                e1);
  293. + #else
  294. +      strcat(strcpy(alloca(strlen(epath)+strlen(e1)+2), epath), ":"),
  295. +                e1);
  296. + #endif
  297. +       else
  298. +     epath = strcpy(alloca(strlen(e1)+1), e1);
  299. +     }
  300. +     if(e2)
  301. +     {
  302. +       if(epath)
  303. +     epath = strcat(
  304. + #ifdef atarist
  305. +      strcat(strcpy(alloca(strlen(epath)+strlen(e2)+2), epath), ","),
  306. +                e2);
  307. + #else
  308. +      strcat(strcpy(alloca(strlen(epath)+strlen(e2)+2), epath), ":"),
  309. +                e2);
  310. + #endif
  311. +       else
  312. +     epath = strcpy(alloca(strlen(e2)+1), e2);
  313. +     }
  314. + #else
  315.       switch ((objc << 1) + cplusplus)
  316. !     {
  317.         case 0:
  318.       epath = getenv ("C_INCLUDE_PATH");
  319.       break;
  320. ***************
  321. *** 1437,1443 ****
  322.         case 3:
  323.       epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  324.       break;
  325. !       }
  326.       /* If the environment var for this language is set,
  327.          add to the default list of include directories.  */
  328.       if (epath) {
  329. --- 1567,1575 ----
  330.         case 3:
  331.       epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  332.       break;
  333. !     }
  334. ! #endif
  335. !     
  336.       /* If the environment var for this language is set,
  337.          add to the default list of include directories.  */
  338.       if (epath) {
  339. ***************
  340. *** 1446,1452 ****
  341. --- 1578,1588 ----
  342.         char *startp, *endp;
  343.   
  344.         for (num_dirs = 1, startp = epath; *startp; startp++)
  345. + #ifdef atarist
  346. +     if ((*startp == ';') || (*startp == ','))
  347. + #else
  348.       if (*startp == ':')
  349. + #endif
  350.         num_dirs++;
  351.         include_defaults
  352.       = (struct default_include *) xmalloc ((num_dirs
  353. ***************
  354. *** 1456,1461 ****
  355. --- 1592,1598 ----
  356.         num_dirs = 0;
  357.         while (1) {
  358.           /* Handle cases like c:/usr/lib:d:/gcc/lib */
  359. + #ifndef atarist
  360.           if ((*endp == ':'
  361.   #ifdef __MSDOS__
  362.            && (endp-startp != 1 || !isalpha (*startp)))
  363. ***************
  364. *** 1462,1467 ****
  365. --- 1599,1607 ----
  366.   #endif
  367.            )
  368.               || (*endp == 0)) {
  369. + #else
  370. +     if ((*endp == ';') || (*endp == ',') || (*endp == '\0')) {
  371. + #endif
  372.         strncpy (nstore, startp, endp-startp);
  373.         if (endp == startp)
  374.           strcpy (nstore, ".");
  375. ***************
  376. *** 1488,1495 ****
  377. --- 1628,1643 ----
  378.        tack on the standard include file dirs to the specified list */
  379.     if (!no_standard_includes) {
  380.       struct default_include *p = include_defaults;
  381. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  382. +     char *specd_prefix = NULL;
  383. + #else
  384.       char *specd_prefix = getenv ("GCC_EXEC_PREFIX");
  385. + #endif
  386. + #ifdef GCC_INCLUDE_DIR
  387.       char *default_prefix = savestring (GCC_INCLUDE_DIR);
  388. + #else
  389. +     char *default_prefix = savestring ("./");
  390. + #endif
  391.       int default_len = 0;
  392.       /* Remove the `include' from /usr/local/lib/gcc.../include.  */
  393.       if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
  394. ***************
  395. *** 1496,1501 ****
  396. --- 1644,1655 ----
  397.         default_len = strlen (default_prefix) - 7;
  398.         default_prefix[default_len] = 0;
  399.       }
  400. + #ifdef atarist
  401. +     else if (!strcmp (default_prefix + strlen (default_prefix) - 8, "\\include")) {
  402. +       default_len = strlen (default_prefix) - 7;
  403. +       default_prefix[default_len] = 0;
  404. +     }
  405. + #endif
  406.       /* Search "translated" versions of GNU directories.
  407.          These have /usr/local/lib/gcc... replaced by specd_prefix.  */
  408.       if (specd_prefix != 0 && default_len != 0)
  409. ***************
  410. *** 1650,1656 ****
  411. --- 1804,1814 ----
  412.         char *p1 = p;
  413.         /* Discard all directory prefixes from P.  */
  414.         while (*p1) {
  415. + #ifdef atarist
  416. +     if ((*p1 == '/') || (*p1 == '\\'))
  417. + #else
  418.       if (*p1 == '/')
  419. + #endif
  420.         p = p1 + 1;
  421.       p1++;
  422.         }
  423. ***************
  424. *** 1810,1815 ****
  425. --- 1968,1974 ----
  426.     return 0;
  427.   }
  428.   
  429. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  430.   /* Given a colon-separated list of file names PATH,
  431.      add all the names to the search path for include files.  */
  432.   
  433. ***************
  434. *** 1869,1874 ****
  435. --- 2028,2034 ----
  436.         p++;
  437.       }
  438.   }
  439. + #endif
  440.   
  441.   /* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF
  442.      before main CCCP processing.  Name `pcp' is also in honor of the
  443. ***************
  444. *** 3453,3460 ****
  445. --- 3613,3629 ----
  446.   
  447.         if (string)
  448.       {
  449. + #ifndef atarist
  450.         buf = (char *) alloca (3 + strlen (string));
  451.         sprintf (buf, "\"%s\"", string);
  452. + #else
  453. +           buf = (char *) alloca (16 + strlen (string));
  454. +           {
  455. +           char *tbuf = (char *) alloca (16 + strlen (string));
  456. +           (void) slashifying_bcopy(string, tbuf, strlen(string)+1);
  457. +           sprintf (buf, "\"%s\"", tbuf);
  458. +           }
  459. + #endif /* atarist */
  460.       }
  461.         else
  462.       buf = "\"\"";
  463. ***************
  464. *** 3657,3663 ****
  465. --- 3826,3837 ----
  466.           dsp[0].next = search_start;
  467.           search_start = dsp;
  468.   #ifndef VMS
  469. + #ifdef atarist
  470. +         if((ep = rindex(nam, '\\')) == NULL)
  471. +         ep = rindex(nam, '/');
  472. + #else
  473.           ep = rindex (nam, '/');
  474. + #endif
  475.   #else                /* VMS */
  476.           ep = rindex (nam, ']');
  477.           if (ep == NULL) ep = rindex (nam, '>');
  478. ***************
  479. *** 3733,3741 ****
  480. --- 3907,3929 ----
  481.   
  482.     /* If specified file name is absolute, just open it.  */
  483.   
  484. + #ifdef atarist
  485. +   if ((*fbeg == '\\') || (*fbeg == '/')) {
  486. +     if(fbeg[2] == ':')
  487. +     { /* allow "\D:\xxx" */
  488. +         strncpy (fname, fbeg+1, flen-1);
  489. +         fname[flen-1] = 0;
  490. +     }
  491. +     else
  492. +     {  /* allow "\lib\xxx" == "\currentdrive:\lib\xxx" */
  493. +         strncpy (fname, fbeg, flen);
  494. +         fname[flen] = 0;
  495. +     }
  496. + #else
  497.     if (*fbeg == '/') {
  498.       strncpy (fname, fbeg, flen);
  499.       fname[flen] = 0;
  500. + #endif
  501.       if (lookup_include (fname))
  502.         return 0;
  503.       if (importing)
  504. ***************
  505. *** 3756,3762 ****
  506. --- 3944,3954 ----
  507.       if (searchptr->fname[0] == 0)
  508.         continue;
  509.       strcpy (fname, searchptr->fname);
  510. + #ifdef atarist
  511. +     strcat (fname, "\\");
  512. + #else
  513.       strcat (fname, "/");
  514. + #endif
  515.       fname[strlen (fname) + flen] = 0;
  516.         } else {
  517.       fname[0] = 0;
  518. ***************
  519. *** 6675,6682 ****
  520. --- 6867,6878 ----
  521.     check_expand (op, len + 1);
  522.     if (op->bufp > op->buf && op->bufp[-1] != '\n')
  523.       *op->bufp++ = '\n';
  524. + #ifdef atarist
  525. +   op->bufp = slashifying_bcopy (line_cmd_buf, op->bufp, len);
  526. + #else
  527.     bcopy (line_cmd_buf, op->bufp, len);
  528.     op->bufp += len;
  529. + #endif
  530.     op->lineno = ip->lineno;
  531.   }
  532.   
  533. ***************
  534. *** 8247,8252 ****
  535. --- 8443,8449 ----
  536.     deps_buffer[deps_size] = 0;
  537.   }
  538.   
  539. + #if (!(defined(atarist) || defined(atariminix)))
  540.   #if defined(USG) || defined(VMS)
  541.   #ifndef BSTRING
  542.   
  543. ***************
  544. *** 8314,8320 ****
  545.   }
  546.   #endif /* not BSTRING */
  547.   #endif /* USG or VMS */
  548.   
  549.   static void
  550.   fatal (str, arg)
  551. --- 8511,8517 ----
  552.   }
  553.   #endif /* not BSTRING */
  554.   #endif /* USG or VMS */
  555. ! #endif /* any atari */
  556.   
  557.   static void
  558.   fatal (str, arg)
  559. *** 1.3    1992/03/27 21:49:26
  560. --- cp-tree.c    1992/03/28 01:50:21
  561. ***************
  562. *** 1579,1584 ****
  563. --- 1579,1585 ----
  564.     print_class_statistics ();
  565.   }
  566.   
  567. + #ifndef atarist
  568.   /* This is used by the `assert' macro.  It is provided in libgcc.a,
  569.      which `cc' doesn't know how to link.  */
  570.   void
  571. ***************
  572. *** 1599,1604 ****
  573. --- 1600,1606 ----
  574.     fflush (stderr);
  575.     abort ();
  576.   }
  577. + #endif
  578.   
  579.   /* Return, as an INTEGER_CST node, the number of elements for
  580.      TYPE (which is an ARRAY_TYPE).  This counts only elements of the top array. */
  581. *** 1.3    1992/03/27 21:49:26
  582. --- dbxout.c    1992/03/28 02:47:32
  583. ***************
  584. *** 138,143 ****
  585. --- 138,146 ----
  586.   #if defined (USG) || defined (NO_STAB_H)
  587.   #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
  588.   #else
  589. + #if defined(CROSSATARI) || defined(atarist) || defined(atariminix)
  590. + #include "astab.h"
  591. + #else
  592.   #include <stab.h>  /* On BSD, use the system's stab.h.  */
  593.   
  594.   /* This is a GNU extension we need to reference in this file.  */
  595. ***************
  596. *** 145,150 ****
  597. --- 148,154 ----
  598.   #define N_CATCH 0x54
  599.   #endif
  600.   #endif /* not USG */
  601. + #endif
  602.   
  603.   #ifdef __GNU_STAB__
  604.   #define STAB_CODE_TYPE enum __stab_debug_code
  605. ***************
  606. *** 400,407 ****
  607. --- 404,417 ----
  608.   #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
  609.         DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile, cwd);
  610.   #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
  611. + #ifndef atarist
  612.         fprintf (asmfile, "%s \"%s/\",%d,0,0,%s\n", ASM_STABS_OP,
  613.              cwd, N_SO, <ext_label_name[1]);
  614. + #else
  615. +     fprintf (asmfile, "%s \"", ASM_STABS_OP);
  616. +     atari_output_filename(asmfile, cwd);
  617. +     fprintf (asmfile, "\\\\\",%d,0,0,%s\n", N_SO, <ext_label_name[1]);
  618. + #endif
  619.   #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
  620.       }
  621.       }
  622. ***************
  623. *** 414,421 ****
  624. --- 424,437 ----
  625.     /* We include outputting `Ltext:' here,
  626.        because that gives you a way to override it.  */
  627.     /* Used to put `Ltext:' before the reference, but that loses on sun 4.  */
  628. + #ifndef atarist
  629.     fprintf (asmfile, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP, input_file_name,
  630.          N_SO, <ext_label_name[1]);
  631. + #else
  632. +   fprintf (asmfile, "%s \"", ASM_STABS_OP);
  633. +   atari_output_filename(asmfile, input_file_name);
  634. +   fprintf(asmfile, "\",%d,0,0,%s\n", N_SO, <ext_label_name[1]);
  635. + #endif
  636.     text_section ();
  637.     ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0);
  638.   #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
  639. ***************
  640. *** 481,488 ****
  641. --- 497,510 ----
  642.         DBX_OUTPUT_SOURCE_FILENAME (file, filename);
  643.   #else
  644.         ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
  645. + #ifndef atarist
  646.         fprintf (file, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP,
  647.              filename, N_SOL, <ext_label_name[1]);
  648. + #else
  649. +       fprintf (file, "%s \"", ASM_STABS_OP);
  650. +       atari_output_filename(file, filename);
  651. +       fprintf (file, "\",%d,0,0,%s\n", N_SOL, <ext_label_name[1]);
  652. + #endif
  653.   #endif
  654.         lastfile = filename;
  655.       }
  656. *** 1.3    1992/03/27 21:49:26
  657. --- final.c    1992/03/28 02:02:34
  658. ***************
  659. *** 67,74 ****
  660. --- 67,78 ----
  661.   #if defined (USG) || defined (NO_STAB_H)
  662.   #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
  663.   #else
  664. + #if defined(CROSSATARI) || defined(atarist) || defined(atariminix)
  665. + #include "astab.h"
  666. + #else
  667.   #include <stab.h>  /* On BSD, use the system's stab.h.  */
  668.   #endif /* not USG */
  669. + #endif /* not atari */
  670.   #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
  671.   
  672.   #ifdef XCOFF_DEBUGGING_INFO
  673. *** 1.4    1992/03/27 21:49:26
  674. --- gcc.c    1992/03/28 03:53:11
  675. ***************
  676. *** 30,35 ****
  677. --- 30,44 ----
  678.   Once it knows which kind of compilation to perform, the procedure for
  679.   compilation is specified by a string called a "spec".  */
  680.   
  681. + #ifdef CROSSATARI
  682. + #ifdef atarist
  683. + #undef atarist
  684. + #endif
  685. + #ifdef atariminix
  686. + #undef atariminix
  687. + #endif
  688. + #endif
  689. +   
  690.   #include <stdio.h>
  691.   #include <sys/types.h>
  692.   #include <ctype.h>
  693. ***************
  694. *** 36,47 ****
  695.   #include <signal.h>
  696.   #include <sys/file.h>
  697.   #include <sys/stat.h>
  698.   
  699.   #include "config.h"
  700.   #include "obstack.h"
  701.   #include "gvarargs.h"
  702.   
  703. ! #ifdef USG
  704.   #ifndef R_OK
  705.   #define R_OK 4
  706.   #define W_OK 2
  707. --- 45,59 ----
  708.   #include <signal.h>
  709.   #include <sys/file.h>
  710.   #include <sys/stat.h>
  711. + #ifdef CROSSATARI
  712. + #include <ctype.h>
  713. + #endif
  714.   
  715.   #include "config.h"
  716.   #include "obstack.h"
  717.   #include "gvarargs.h"
  718.   
  719. ! #if (defined(USG) || defined(atariminix))
  720.   #ifndef R_OK
  721.   #define R_OK 4
  722.   #define W_OK 2
  723. ***************
  724. *** 78,83 ****
  725. --- 90,102 ----
  726.   #endif
  727.   #endif
  728.   
  729. + #ifdef atarist
  730. + #include <osbind.h>
  731. + #include <ctype.h>
  732. + #include <fcntl.h>        /* fgth, for redirection of stderr */
  733. + long _stksize = 8192;
  734. + #endif
  735.   #define obstack_chunk_alloc xmalloc
  736.   #define obstack_chunk_free free
  737.   
  738. ***************
  739. *** 129,135 ****
  740. --- 148,156 ----
  741.      pass the compiler in building the list of pointers to constructors
  742.      and destructors.  */
  743.   
  744. + #if (!(defined(CROSSATARI) || defined(atarist)))
  745.   static struct obstack collect_obstack;
  746. + #endif
  747.   
  748.   extern char *version_string;
  749.   
  750. ***************
  751. *** 401,406 ****
  752. --- 422,430 ----
  753.           -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  754.       %{!undef:%{!ansi:%p} %P} %{trigraphs}\
  755.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  756. +         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
  757. +         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
  758. +         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
  759.           %{traditional-cpp:-traditional}\
  760.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  761.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
  762. ***************
  763. *** 411,417 ****
  764.              %{aux-info*}\
  765.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  766.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  767. !               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  768.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  769.                         %{!pipe:%g.s} %A\n }}}}"},
  770.     {"-",
  771. --- 435,441 ----
  772.              %{aux-info*}\
  773.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  774.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  775. !               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  776.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  777.                         %{!pipe:%g.s} %A\n }}}}"},
  778.     {"-",
  779. ***************
  780. *** 421,426 ****
  781. --- 445,453 ----
  782.           -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  783.       %{!undef:%{!ansi:%p} %P} %{trigraphs}\
  784.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  785. +         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
  786. +         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
  787. +         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
  788.           %{traditional-cpp:-traditional}\
  789.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  790.           %i %W{o*}}\
  791. ***************
  792. *** 433,438 ****
  793. --- 460,468 ----
  794.           -undef -D__OBJC__ -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  795.       %{!undef:%{!ansi:%p} %P} %{trigraphs}\
  796.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  797. +         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
  798. +         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
  799. +         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
  800.           %{traditional-cpp:-traditional}\
  801.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  802.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
  803. ***************
  804. *** 444,450 ****
  805.              %{aux-info*}\
  806.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  807.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  808. !               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  809.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  810.                         %{!pipe:%g.s} %A\n }}}}"},
  811.     {".h", "@c-header"},
  812. --- 474,480 ----
  813.              %{aux-info*}\
  814.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  815.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  816. !               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  817.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  818.                         %{!pipe:%g.s} %A\n }}}}"},
  819.     {".h", "@c-header"},
  820. ***************
  821. *** 456,461 ****
  822. --- 486,494 ----
  823.           -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
  824.       %{!undef:%{!ansi:%p} %P} %{trigraphs}\
  825.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  826. +         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
  827. +         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
  828. +         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
  829.           %{traditional-cpp:-traditional}\
  830.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  831.           %i %W{o*}"},
  832. ***************
  833. *** 469,474 ****
  834. --- 502,510 ----
  835.       -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus \
  836.       %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
  837.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  838. +         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
  839. +         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
  840. +         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
  841.           %{traditional-cpp:-traditional} %{trigraphs}\
  842.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  843.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
  844. ***************
  845. *** 479,485 ****
  846.              %{aux-info*}\
  847.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  848.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  849. !               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  850.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  851.                         %{!pipe:%g.s} %A\n }}}}"},
  852.     {".i", "@cpp-output"},
  853. --- 515,521 ----
  854.              %{aux-info*}\
  855.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  856.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  857. !               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  858.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  859.                         %{!pipe:%g.s} %A\n }}}}"},
  860.     {".i", "@cpp-output"},
  861. ***************
  862. *** 490,496 ****
  863.       %{aux-info*}\
  864.       %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  865.       %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  866. !     %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  867.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %{!pipe:%g.s} %A\n }"},
  868.     {".ii", "@c++-cpp-output"},
  869.     {"@c++-cpp-output",
  870. --- 526,532 ----
  871.       %{aux-info*}\
  872.       %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  873.       %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  874. !     %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  875.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %{!pipe:%g.s} %A\n }"},
  876.     {".ii", "@c++-cpp-output"},
  877.     {"@c++-cpp-output",
  878. ***************
  879. *** 500,511 ****
  880.           %{aux-info*}\
  881.           %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  882.           %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  883. !        %{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  884.              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  885.              %{!pipe:%g.s} %A\n }"},
  886.     {".s", "@assembler"},
  887.     {"@assembler",
  888. !    "%{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  889.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %i %A\n }"},
  890.     {".S", "@assembler-with-cpp"},
  891.     {"@assembler-with-cpp",
  892. --- 536,547 ----
  893.           %{aux-info*}\
  894.           %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  895.           %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  896. !        %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  897.              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  898.              %{!pipe:%g.s} %A\n }"},
  899.     {".s", "@assembler"},
  900.     {"@assembler",
  901. !    "%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  902.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %i %A\n }"},
  903.     {".S", "@assembler-with-cpp"},
  904.     {"@assembler-with-cpp",
  905. ***************
  906. *** 514,523 ****
  907.       %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{trigraphs} \
  908.           -undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
  909.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  910.           %{traditional-cpp:-traditional}\
  911.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  912.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
  913. !     %{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a \
  914.                       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  915.               %{!pipe:%g.s} %A\n }}}}"},
  916.     /* Mark end of table */
  917. --- 550,562 ----
  918.       %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{trigraphs} \
  919.           -undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
  920.           %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
  921. +         %{mshort:-D__MSHORT__} %{mint:-D__MINT__}\
  922. +         %{m68881:-D__M68881__} %{m68020:-D__M68020__}\
  923. +         %{mc68881:-D__M68881__} %{mc68020:-D__M68020__}\
  924.           %{traditional-cpp:-traditional}\
  925.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  926.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n\
  927. !     %{!M:%{!MM:%{!E:%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a \
  928.                       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
  929.               %{!pipe:%g.s} %A\n }}}}"},
  930.     /* Mark end of table */
  931. ***************
  932. *** 531,536 ****
  933. --- 570,584 ----
  934.   
  935.   /* Here is the spec for running the linker, after compiling all files.  */
  936.   
  937. + #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  938. + static char *link_command_spec = 
  939. +  "%{!c:%{!M*:%{!E:%{!S:ld %{v} %{G} %{o*} %l\
  940. +  %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
  941. +  %{y*} %{!nostdlib:%S} \
  942. +  %{L*} %o %{!nostdlib:%s %L}\n }}}}";
  943. + #else
  944.   #ifdef LINK_LIBGCC_SPECIAL
  945.   /* Have gcc do the search.  */
  946.   static char *link_command_spec = "\
  947. ***************
  948. *** 546,551 ****
  949. --- 594,600 ----
  950.               %{!A:%{!nostdlib:%S}} \
  951.               %{L*} %D %o %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}\n }}}}}";
  952.   #endif
  953. + #endif
  954.   
  955.   /* A vector of options to give to the linker.
  956.      These options are accumlated by %x
  957. ***************
  958. *** 553,558 ****
  959. --- 602,608 ----
  960.   static int n_linker_options;
  961.   static char **linker_options;
  962.   
  963. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  964.   /* Read compilation specs from a file named FILENAME,
  965.      replacing the default ones.
  966.   
  967. ***************
  968. *** 689,694 ****
  969. --- 739,745 ----
  970.   
  971.     return p;
  972.   }
  973. + #endif /* ataris */
  974.   
  975.   /* Structure to keep track of the specs that have been defined so far.  These
  976.      are accessed using %(specname) or %[specname] in a compiler or link spec. */
  977. ***************
  978. *** 789,794 ****
  979. --- 840,852 ----
  980.   /* Name with which this program was invoked.  */
  981.   
  982.   static char *programname;
  983. + #ifdef atarist
  984. + /* Flag indicating, that stderr should be redirected for the child
  985. +    processes */
  986. + unsigned char zflag;
  987. + #endif
  988.   
  989.   /* Structures to keep track of prefixes to try when looking for files. */
  990.   
  991. ***************
  992. *** 1030,1038 ****
  993.   static void
  994.   choose_temp_base ()
  995.   {
  996. -   char *base = getenv ("TMPDIR");
  997.     int len;
  998.   
  999.     if (base == (char *)0)
  1000.       {
  1001.   #ifdef P_tmpdir
  1002. --- 1088,1113 ----
  1003.   static void
  1004.   choose_temp_base ()
  1005.   {
  1006.     int len;
  1007. + #if (!(defined(atarist) || defined(atariminix)))
  1008. +   char *base = getenv ("TMPDIR");
  1009. + #else
  1010. +   char *base = getenv ("TEMP");
  1011.   
  1012. +   if(base == (char *)0)
  1013. +   {
  1014. +       base = getenv("TMPDIR");
  1015. +       if(base == (char *)0)
  1016. +       base = getenv("TMP");
  1017. +   }
  1018. +   if(base != (char *)0)
  1019. +   {
  1020. +       char *newbase = alloca(FILENAME_MAX);
  1021. +       dos2unx(base,newbase);
  1022. +       base = newbase;
  1023. +   }
  1024. + #endif
  1025.     if (base == (char *)0)
  1026.       {
  1027.   #ifdef P_tmpdir
  1028. ***************
  1029. *** 1051,1057 ****
  1030.     len = strlen (base);
  1031.     temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
  1032.     strcpy (temp_filename, base);
  1033. !   if (len > 0 && temp_filename[len-1] != '/')
  1034.       temp_filename[len++] = '/';
  1035.     strcpy (temp_filename + len, "ccXXXXXX");
  1036.   
  1037. --- 1126,1136 ----
  1038.     len = strlen (base);
  1039.     temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
  1040.     strcpy (temp_filename, base);
  1041. !   if (len > 0 && (temp_filename[len-1] != '/' 
  1042. ! #ifdef atarist
  1043. !           || temp_filename[len-1] != '\\'
  1044. ! #endif
  1045. !            ))
  1046.       temp_filename[len++] = '/';
  1047.     strcpy (temp_filename + len, "ccXXXXXX");
  1048.   
  1049. ***************
  1050. *** 1068,1073 ****
  1051. --- 1147,1153 ----
  1052.      use come from an obstack, we don't have to worry about allocating
  1053.      space for them.  */
  1054.   
  1055. + #if (!(defined(CROSSATARI) || defined(atarist)))
  1056.   #ifndef HAVE_PUTENV
  1057.   
  1058.   putenv (str)
  1059. ***************
  1060. *** 1154,1159 ****
  1061. --- 1234,1240 ----
  1062.     obstack_grow (&collect_obstack, "\0", 1);
  1063.     putenv (obstack_finish (&collect_obstack));
  1064.   }
  1065. + #endif /* ataris */
  1066.   
  1067.   
  1068.   /* Search for NAME using the prefix list PREFIXES.  MODE is passed to
  1069. ***************
  1070. *** 1389,1394 ****
  1071. --- 1470,1476 ----
  1072.   
  1073.   #else /* not __MSDOS__ */
  1074.   
  1075. + #ifndef atarist
  1076.   static int
  1077.   pexecute (func, program, argv, not_last)
  1078.        char *program;
  1079. ***************
  1080. *** 1476,1481 ****
  1081. --- 1558,1564 ----
  1082.       }
  1083.   }
  1084.   
  1085. + #endif /* not atarist */
  1086.   #endif /* not __MSDOS__ */
  1087.   
  1088.   /* Execute the command specified by the arguments on the current line of spec.
  1089. ***************
  1090. *** 1494,1509 ****
  1091.       {
  1092.         char *prog;        /* program name.  */
  1093.         char **argv;        /* vector of args.  */
  1094.         int pid;            /* pid of process for this command.  */
  1095.       };
  1096.   
  1097.     struct command *commands;    /* each command buffer with above info.  */
  1098.   
  1099.     /* Count # of piped commands.  */
  1100.     for (n_commands = 1, i = 0; i < argbuf_index; i++)
  1101.       if (strcmp (argbuf[i], "|") == 0)
  1102.         n_commands++;
  1103.     /* Get storage for each command.  */
  1104.     commands
  1105.       = (struct command *) alloca (n_commands * sizeof (struct command));
  1106. --- 1577,1597 ----
  1107.       {
  1108.         char *prog;        /* program name.  */
  1109.         char **argv;        /* vector of args.  */
  1110. + #ifndef atarist
  1111.         int pid;            /* pid of process for this command.  */
  1112. + #endif
  1113.       };
  1114.   
  1115.     struct command *commands;    /* each command buffer with above info.  */
  1116.   
  1117. + #ifndef atarist
  1118.     /* Count # of piped commands.  */
  1119.     for (n_commands = 1, i = 0; i < argbuf_index; i++)
  1120.       if (strcmp (argbuf[i], "|") == 0)
  1121.         n_commands++;
  1122. ! #else
  1123. !   n_commands = 1;
  1124. ! #endif
  1125.     /* Get storage for each command.  */
  1126.     commands
  1127.       = (struct command *) alloca (n_commands * sizeof (struct command));
  1128. ***************
  1129. *** 1518,1523 ****
  1130. --- 1606,1612 ----
  1131.     if (string)
  1132.       commands[0].argv[0] = string;
  1133.   
  1134. + #ifndef atarist
  1135.     for (n_commands = 1, i = 0; i < argbuf_index; i++)
  1136.       if (strcmp (argbuf[i], "|") == 0)
  1137.         {                /* each command.  */
  1138. ***************
  1139. *** 1532,1537 ****
  1140. --- 1621,1629 ----
  1141.         commands[n_commands].argv[0] = string;
  1142.       n_commands++;
  1143.         }
  1144. + #else
  1145. +   n_commands = 1;
  1146. + #endif
  1147.   
  1148.     argbuf[argbuf_index] = 0;
  1149.   
  1150. ***************
  1151. *** 1547,1555 ****
  1152. --- 1639,1649 ----
  1153.         for (j = commands[i].argv; *j; j++)
  1154.           fprintf (stderr, " %s", *j);
  1155.   
  1156. + #ifndef atarist
  1157.         /* Print a pipe symbol after all but the last command.  */
  1158.         if (i + 1 != n_commands)
  1159.           fprintf (stderr, " |");
  1160. + #endif
  1161.         fprintf (stderr, "\n");
  1162.       }
  1163.         fflush (stderr);
  1164. ***************
  1165. *** 1564,1574 ****
  1166. --- 1658,1670 ----
  1167.   #endif /* DEBUG */
  1168.       }
  1169.   
  1170. + #ifndef atarist
  1171.     /* Run each piped subprocess.  */
  1172.   
  1173.     last_pipe_input = STDIN_FILE_NO;
  1174.     for (i = 0; i < n_commands; i++)
  1175.       {
  1176. + #ifndef atariminix
  1177.         char *string = commands[i].argv[0];
  1178.   
  1179.         commands[i].pid = pexecute ((string != commands[i].prog ? execv : execvp),
  1180. ***************
  1181. *** 1575,1580 ****
  1182. --- 1671,1684 ----
  1183.                     string, commands[i].argv,
  1184.                     i + 1 < n_commands);
  1185.   
  1186. + #else
  1187. +       extern int execv();
  1188. +       char *string = commands[i].argv[0];
  1189. +       commands[i].pid = pexecute (execv,
  1190. +                   string, commands[i].argv,
  1191. +                   i + 1 < n_commands);
  1192. + #endif
  1193.         if (string != commands[i].prog)
  1194.       free (string);
  1195.       }
  1196. ***************
  1197. *** 1618,1623 ****
  1198. --- 1722,1772 ----
  1199.         }
  1200.       return ret_code;
  1201.     }
  1202. + #else /* atarist */
  1203. +  {
  1204. +      register int iii;
  1205. +      int errfd, oldfd;
  1206. +      char **j;
  1207. +      execution_count++;
  1208. +      if (zflag)
  1209. +        {
  1210. +      errfd = Fopen("compile.err", 2);
  1211. +      if (errfd < __SMALLEST_VALID_HANDLE)
  1212. +        errfd = Fcreate("compile.err", 0);
  1213. +      else
  1214. +        Fseek(0L, errfd, 2);
  1215. +      if (errfd >= __SMALLEST_VALID_HANDLE)
  1216. +        {
  1217. +          oldfd = Fdup (2);
  1218. +          Fforce(2, errfd);
  1219. +        }
  1220. +      else
  1221. +        {
  1222. +          error("cannot open %s", "compile.err");
  1223. +          zflag = 0;        /* no redirection */
  1224. +        }
  1225. +        }
  1226. +      for (i = 0; i < n_commands ; i++)
  1227. +      {
  1228. +          j = commands[i].argv;
  1229. +          iii = spawnve(0, j[0], j, NULL);
  1230. +      if(iii != 0)
  1231. +          break;
  1232. +      }
  1233. +      if (zflag)
  1234. +        {
  1235. +      Fforce(2, oldfd);
  1236. +      Fclose(oldfd);
  1237. +      Fclose(errfd);
  1238. +        }
  1239. +      if (iii != 0)
  1240. +        return -1;
  1241. +      else
  1242. +        return 0;
  1243. +  }
  1244. + #endif /* atarist */  
  1245.   }
  1246.   
  1247.   /* Find all the switches given to us
  1248. ***************
  1249. *** 1675,1680 ****
  1250. --- 1824,1830 ----
  1251.   
  1252.     /* Set up the default search paths.  */
  1253.   
  1254. + #ifndef CROSSATARI
  1255.     temp = getenv ("GCC_EXEC_PREFIX");
  1256.     if (temp)
  1257.       {
  1258. ***************
  1259. *** 1752,1757 ****
  1260. --- 1902,1908 ----
  1261.           endp++;
  1262.       }
  1263.       }
  1264. + #endif /* CROSSATARI */
  1265.   
  1266.     /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
  1267.     temp = getenv ("LPATH");
  1268. ***************
  1269. *** 1887,1892 ****
  1270. --- 2038,2049 ----
  1271.             save_temps_flag = 1;
  1272.             break;
  1273.           }
  1274. + #ifdef atarist
  1275. +         case 'z':    /* redirect stderr to a file */
  1276. +           zflag++;
  1277. +           n_switches++;
  1278. +           break;
  1279. + #endif
  1280.           default:
  1281.             n_switches++;
  1282.   
  1283. ***************
  1284. *** 2042,2047 ****
  1285. --- 2199,2213 ----
  1286.      search dirs for it.  */
  1287.   static int this_is_library_file;
  1288.   
  1289. + #ifdef atarist
  1290. + /* I don't know why this is necessary.  Recursive calls to do_spec_1
  1291. +    end up ignoring the error code from calls to execute().  That causes
  1292. +    do_spec to get a 0 return value, and do_spec_1("\n"), which causes the
  1293. +    command to get executed again.
  1294. + */
  1295. + int execute_return_error = 0;
  1296. + #endif
  1297.   /* Process the spec SPEC and run the commands specified therein.
  1298.      Returns 0 if the spec is successfully processed; -1 if failed.  */
  1299.   
  1300. ***************
  1301. *** 2061,2070 ****
  1302. --- 2227,2245 ----
  1303.   
  1304.     /* Force out any unfinished command.
  1305.        If -pipe, this forces out the last command if it ended in `|'.  */
  1306. + #ifdef atarist
  1307. +   if (!value && execute_return_error)
  1308. +     {
  1309. +     value = execute_return_error;
  1310. +     execute_return_error = 0;
  1311. +     }
  1312. + #endif
  1313.     if (value == 0)
  1314.       {
  1315. + #ifndef atarist
  1316.         if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
  1317.       argbuf_index--;
  1318. + #endif
  1319.   
  1320.         if (argbuf_index > 0)
  1321.       value = execute ();
  1322. ***************
  1323. *** 2101,2106 ****
  1324. --- 2276,2332 ----
  1325.          Otherwise, NL, SPC, TAB and % are special.  */
  1326.       switch (inswitch ? 'a' : c)
  1327.         {
  1328. + #if (defined(atarist) || defined(CROSSATARI))
  1329. + /* this stuff added by jrd.  if see '$', expect name of env var, delimited
  1330. +    by '$'.  Find it's value, and subst it in.
  1331. +    modified by ERS to only collect things that look like names; this
  1332. +    saves e.g. the -$ arg. to cpp from getting munged */
  1333. +       case '$':
  1334. +       {
  1335. +     char varname[32];        /* should be enough */
  1336. +     char * value;            /* deciphered value string */
  1337. +     char *temp;
  1338. +     int i;
  1339. +     extern char *getenv(), *index();
  1340. +     
  1341. +     for (i = 0 ; ((c = *p) != '$') && isalnum(c) && i < 31 ; i++, p++)
  1342. +         varname[i] = c;
  1343. +     varname[i] = '\0';
  1344. +     if (strlen(varname) > 0) /* ++jrb fix */
  1345. +     {
  1346. +                  ++p;    /* skip trailing '$' */
  1347. +         value = getenv(varname); /* ++jrb fix */
  1348. +         if (value)
  1349. +         { /* if value is a path, only consider 1'st component */
  1350. + #ifdef atarist
  1351. +             if((temp = index(value, ',')) == NULL)
  1352. +                 temp = index(value, ';');
  1353. + #else
  1354. +             temp = index(value, ':');
  1355. + #endif
  1356. +             if(temp != NULL)
  1357. +             {
  1358. +                 char *t = (char *) alloca(strlen(value) + 1);
  1359. +                 strcpy(t, value);
  1360. +                 t[temp-value] = '\0';
  1361. +                 do_spec_1(t, 0);
  1362. +             }
  1363. +             else
  1364. +                 do_spec_1(value, 0);
  1365. +         }
  1366. +             else
  1367. +             do_spec_1(".", 0);    /* a compleat kludge... */
  1368. +     }
  1369. +         else
  1370. +         {
  1371. +              obstack_1grow(&obstack, '$');
  1372. +              arg_going = 1;
  1373. +         }
  1374. +       }
  1375. +      break;
  1376. + #endif /* atarist */
  1377.         case '\n':
  1378.       /* End of line: finish any pending argument,
  1379.          then run the pending command if one has been started.  */
  1380. ***************
  1381. *** 2138,2143 ****
  1382. --- 2364,2373 ----
  1383.       if (argbuf_index > 0)
  1384.         {
  1385.           int value = execute ();
  1386. + #ifdef atarist
  1387. +         if (!execute_return_error)
  1388. +             execute_return_error = value;
  1389. + #endif
  1390.           if (value)
  1391.             return value;
  1392.         }
  1393. ***************
  1394. *** 2626,2638 ****
  1395. --- 2856,2876 ----
  1396.           break;
  1397.   
  1398.         default:
  1399. + #if 1 /* atarist */
  1400. +         fprintf(stderr, "Bogus char '%c' found at pos %d of spec '%s'\n",
  1401. +         c, (p - spec - 1), spec);
  1402. + #endif
  1403.           abort ();
  1404.         }
  1405.       break;
  1406.   
  1407. + #ifndef atarist
  1408. +       /* on the atari it is important to preserve backslash in spec */
  1409. +       /* so just let it go into default case */
  1410.         case '\\':
  1411.       /* Backslash: treat next character as ordinary.  */
  1412.       c = *p++;
  1413. + #endif
  1414.   
  1415.       /* fall through */
  1416.         default:
  1417. ***************
  1418. *** 2900,2905 ****
  1419. --- 3138,3144 ----
  1420.   
  1421.   /* On fatal signals, delete all the temporary files.  */
  1422.   
  1423. + #ifndef atarist
  1424.   static void
  1425.   fatal_error (signum)
  1426.        int signum;
  1427. ***************
  1428. *** 2911,2916 ****
  1429. --- 3150,3156 ----
  1430.        so its normal effect occurs.  */
  1431.     kill (getpid (), signum);
  1432.   }
  1433. + #endif
  1434.   
  1435.   int
  1436.   main (argc, argv)
  1437. ***************
  1438. *** 2924,2929 ****
  1439. --- 3164,3174 ----
  1440.     char *explicit_link_files;
  1441.     char *specs_file;
  1442.   
  1443. + #ifdef atarist
  1444. + /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  1445. + /*  _malloczero(1); */     /* zero mallocs by default */
  1446. +   programname = "gcc";
  1447. + #else  
  1448.     programname = argv[0];
  1449.   
  1450.     if (signal (SIGINT, SIG_IGN) != SIG_IGN)
  1451. ***************
  1452. *** 2936,2941 ****
  1453. --- 3181,3187 ----
  1454.     if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
  1455.       signal (SIGPIPE, fatal_error);
  1456.   #endif
  1457. + #endif /* atarist */
  1458.   
  1459.     argbuf_length = 10;
  1460.     argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
  1461. ***************
  1462. *** 2942,2947 ****
  1463. --- 3188,3194 ----
  1464.   
  1465.     obstack_init (&obstack);
  1466.   
  1467. + #if (!(defined(atarist) || defined(CROSSATARI)))
  1468.     /* Set up to remember the pathname of gcc and any options
  1469.        needed for collect.  */
  1470.     obstack_init (&collect_obstack);
  1471. ***************
  1472. *** 2948,2953 ****
  1473. --- 3195,3201 ----
  1474.     obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=")-1);
  1475.     obstack_grow (&collect_obstack, programname, strlen (programname)+1);
  1476.     putenv (obstack_finish (&collect_obstack));
  1477. + #endif
  1478.   
  1479.     /* Choose directory for temp files.  */
  1480.   
  1481. ***************
  1482. *** 2959,2964 ****
  1483. --- 3207,3221 ----
  1484.   
  1485.     process_command (argc, argv);
  1486.   
  1487. + #if (defined(atarist) || defined(CROSSATARI))
  1488. +   {
  1489. +     char *temp;
  1490. +     
  1491. +     if((temp = getenv ("GCCEXEC")))
  1492. +     add_prefix (&exec_prefix, temp, 0, 0, 0);
  1493. +   }
  1494. + #endif
  1495. +   
  1496.     /* Initialize the vector of specs to just the default.
  1497.        This means one element containing 0s, as a terminator.  */
  1498.   
  1499. ***************
  1500. *** 2966,2971 ****
  1501. --- 3223,3232 ----
  1502.     bcopy (default_compilers, compilers, sizeof default_compilers);
  1503.     n_compilers = n_default_compilers;
  1504.   
  1505. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  1506. +   specs_file = 0;
  1507. + #else
  1508.     /* Read specs from a file if there is one.  */
  1509.   
  1510.     machine_suffix = concat (spec_machine, "/", concat (spec_version, "/", ""));
  1511. ***************
  1512. *** 2974,2979 ****
  1513. --- 3235,3241 ----
  1514.     /* Read the specs file unless it is a default one.  */
  1515.     if (specs_file != 0 && strcmp (specs_file, "specs"))
  1516.       read_specs (specs_file);
  1517. + #endif
  1518.   
  1519.     /* If not cross-compiling, look for startfiles in the standard places.  */
  1520.     /* The fact that these are done here, after reading the specs file,
  1521. ***************
  1522. *** 3013,3019 ****
  1523. --- 3275,3287 ----
  1524.   
  1525.     if (verbose_flag)
  1526.       {
  1527. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  1528. + #include "PatchLev.h"
  1529. +       fprintf (stderr, "gcc-atariST version %s Patchlevel %s\n",
  1530. +            version_string, PatchLevel);
  1531. + #else
  1532.         fprintf (stderr, "gcc version %s\n", version_string);
  1533. + #endif
  1534.         if (n_infiles == 0)
  1535.       exit (0);
  1536.       }
  1537. ***************
  1538. *** 3060,3066 ****
  1539. --- 3328,3339 ----
  1540.   
  1541.         input_basename = input_filename;
  1542.         for (p = input_filename; *p; p++)
  1543. + #ifdef atarist
  1544. +         if (((*p == '/') || (*p == '\\')) && (*(p-1) != ':'))
  1545. +             /* allow both '\' and '/' with  our new lib */
  1546. + #else
  1547.           if (*p == '/')
  1548. + #endif
  1549.             input_basename = p + 1;
  1550.   
  1551.         /* Find a suffix starting with the last period,
  1552. ***************
  1553. *** 3107,3112 ****
  1554. --- 3380,3386 ----
  1555.         int i;
  1556.         int first_time;
  1557.   
  1558. + #if (!(defined(atarist) || defined(CROSSATARI)))
  1559.         /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
  1560.        for collect.  */
  1561.         putenv_from_prefixes (&exec_prefix, "COMPILER_PATH=");
  1562. ***************
  1563. *** 3137,3142 ****
  1564. --- 3411,3417 ----
  1565.       }
  1566.         obstack_grow (&collect_obstack, "\0", 1);
  1567.         putenv (obstack_finish (&collect_obstack));
  1568. + #endif
  1569.   
  1570.         value = do_spec (link_command_spec);
  1571.         if (value < 0)
  1572. *** 1.1    1992/03/27 21:49:26
  1573. --- getpwd.c    1992/03/28 03:12:41
  1574. ***************
  1575. *** 14,20 ****
  1576.      BSD systems) now provides getcwd as called for by POSIX.  Allow for
  1577.      the few exceptions to the general rule here.  */
  1578.   
  1579. ! #if !(defined (POSIX) || defined (USG) || defined (VMS))
  1580.   #include <sys/param.h>
  1581.   extern char *getwd ();
  1582.   #define getcwd(buf,len) getwd(buf)
  1583. --- 14,20 ----
  1584.      BSD systems) now provides getcwd as called for by POSIX.  Allow for
  1585.      the few exceptions to the general rule here.  */
  1586.   
  1587. ! #if !(defined (POSIX) || defined (USG) || defined (VMS) || defined(atarist))
  1588.   #include <sys/param.h>
  1589.   extern char *getwd ();
  1590.   #define getcwd(buf,len) getwd(buf)
  1591. ***************
  1592. *** 46,56 ****
  1593.     if (!p && !(errno = failure_errno))
  1594.       {
  1595.         if (! ((p = getenv ("PWD")) != 0
  1596.            && *p == '/'
  1597.            && stat (p, &pwdstat) == 0
  1598.            && stat (".", &dotstat) == 0
  1599.            && dotstat.st_ino == pwdstat.st_ino
  1600. !          && dotstat.st_dev == pwdstat.st_dev))
  1601.   
  1602.       /* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  1603.       for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
  1604. --- 46,59 ----
  1605.     if (!p && !(errno = failure_errno))
  1606.       {
  1607.         if (! ((p = getenv ("PWD")) != 0
  1608. + #ifndef atarist
  1609.            && *p == '/'
  1610.            && stat (p, &pwdstat) == 0
  1611.            && stat (".", &dotstat) == 0
  1612.            && dotstat.st_ino == pwdstat.st_ino
  1613. !          && dotstat.st_dev == pwdstat.st_dev
  1614. ! #endif
  1615. !          ))
  1616.   
  1617.       /* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  1618.       for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
  1619. *** 1.3    1992/03/27 21:49:26
  1620. --- toplev.c    1992/03/28 01:55:06
  1621. ***************
  1622. *** 31,37 ****
  1623.   
  1624.   #include <sys/stat.h>
  1625.   
  1626. ! #ifdef USG
  1627.   #undef FLOAT
  1628.   #include <sys/param.h>
  1629.   /* This is for hpux.  It is a real screw.  They should change hpux.  */
  1630. --- 31,37 ----
  1631.   
  1632.   #include <sys/stat.h>
  1633.   
  1634. ! #if defined(USG) || defined(CROSSHPUX)
  1635.   #undef FLOAT
  1636.   #include <sys/param.h>
  1637.   /* This is for hpux.  It is a real screw.  They should change hpux.  */
  1638. ***************
  1639. *** 41,49 ****
  1640. --- 41,57 ----
  1641.   #undef FFS  /* Some systems define this in param.h.  */
  1642.   #else
  1643.   #ifndef VMS
  1644. + #if (!(defined(atarist) || defined(atariminix)))
  1645.   #include <sys/time.h>
  1646.   #include <sys/resource.h>
  1647. + #endif /* !(atarist || atariminix) */
  1648. + #endif
  1649.   #endif
  1650. + #ifdef atariminix
  1651. + #include <sys/times.h>
  1652. + /* #include <minix/const.h>, avoid dragging this in */
  1653. + #define HZ 60    /* this is the only thing needed from minix/const.h */
  1654.   #endif
  1655.   
  1656.   #include "input.h"
  1657. ***************
  1658. *** 57,62 ****
  1659. --- 65,79 ----
  1660.   #include "xcoffout.h"
  1661.   #endif
  1662.   
  1663. + #ifdef atarist
  1664. + long _stksize = -1L;    /* for all sizes of ST's */
  1665. +     /* -1 means malloc from own heap and keep all  of memory */
  1666. + #endif /* atarist */
  1667. + #if (defined(atarist) || defined(atariminix))
  1668. + #include "astab.h"    /* need this for ASM_OUTPUT_SOURCE_FILENAME */
  1669. + #endif
  1670.   #ifdef VMS
  1671.   /* The extra parameters substantially improve the I/O performance.  */
  1672.   static FILE *
  1673. ***************
  1674. *** 586,592 ****
  1675.   int
  1676.   get_run_time ()
  1677.   {
  1678. ! #ifdef USG
  1679.     struct tms tms;
  1680.   #else
  1681.   #ifndef VMS
  1682. --- 603,612 ----
  1683.   int
  1684.   get_run_time ()
  1685.   {
  1686. ! #ifdef atarist
  1687. !   long now;
  1688. ! #else
  1689. ! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
  1690.     struct tms tms;
  1691.   #else
  1692.   #ifndef VMS
  1693. ***************
  1694. *** 601,611 ****
  1695.       } vms_times;
  1696.   #endif
  1697.   #endif
  1698.   
  1699.     if (quiet_flag)
  1700.       return 0;
  1701.   
  1702. ! #ifdef USG
  1703.     times (&tms);
  1704.     return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  1705.   #else
  1706. --- 621,635 ----
  1707.       } vms_times;
  1708.   #endif
  1709.   #endif
  1710. + #endif
  1711.   
  1712.     if (quiet_flag)
  1713.       return 0;
  1714.   
  1715. ! #ifdef atarist
  1716. !   return(time(NULL) * 1000000);
  1717. ! #else
  1718. ! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
  1719.     times (&tms);
  1720.     return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  1721.   #else
  1722. ***************
  1723. *** 618,623 ****
  1724. --- 642,648 ----
  1725.     return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  1726.   #endif
  1727.   #endif
  1728. + #endif
  1729.   }
  1730.   
  1731.   #define TIMEVAR(VAR, BODY)    \
  1732. ***************
  1733. *** 1220,1225 ****
  1734. --- 1245,1251 ----
  1735.     longjmp (float_handler, 1);
  1736.   }
  1737.   
  1738. + #ifndef atarist
  1739.   /* Handler for SIGPIPE.  */
  1740.   
  1741.   static void
  1742. ***************
  1743. *** 1229,1234 ****
  1744. --- 1255,1261 ----
  1745.   {
  1746.     fatal ("output pipe has been closed");
  1747.   }
  1748. + #endif
  1749.   
  1750.   /* Strip off a legitimate source ending from the input string NAME of
  1751.      length LEN. */
  1752. ***************
  1753. *** 1378,1384 ****
  1754. --- 1405,1415 ----
  1755.       {
  1756.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1757.         strcpy (dumpname, dump_base_name);
  1758. + #ifndef atarist
  1759.         strcat (dumpname, ".jump");
  1760. + #else
  1761. +       strcat (dumpname, ".jmp");
  1762. + #endif
  1763.         jump_opt_dump_file = fopen (dumpname, "w");
  1764.         if (jump_opt_dump_file == 0)
  1765.       pfatal_with_name (dumpname);
  1766. ***************
  1767. *** 1400,1406 ****
  1768. --- 1431,1441 ----
  1769.       {
  1770.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1771.         strcpy (dumpname, dump_base_name);
  1772. + #ifndef atarist
  1773.         strcat (dumpname, ".loop");
  1774. + #else
  1775. +       strcat (dumpname, ".lop");
  1776. + #endif
  1777.         loop_dump_file = fopen (dumpname, "w");
  1778.         if (loop_dump_file == 0)
  1779.       pfatal_with_name (dumpname);
  1780. ***************
  1781. *** 1411,1417 ****
  1782. --- 1446,1456 ----
  1783.       {
  1784.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1785.         strcpy (dumpname, dump_base_name);
  1786. + #ifndef atarist
  1787.         strcat (dumpname, ".cse2");
  1788. + #else
  1789. +       strcat (dumpname, ".cs2");
  1790. + #endif
  1791.         cse2_dump_file = fopen (dumpname, "w");
  1792.         if (cse2_dump_file == 0)
  1793.       pfatal_with_name (dumpname);
  1794. ***************
  1795. *** 1422,1428 ****
  1796. --- 1461,1471 ----
  1797.       {
  1798.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1799.         strcpy (dumpname, dump_base_name);
  1800. + #ifndef atarist
  1801.         strcat (dumpname, ".flow");
  1802. + #else
  1803. +       strcat (dumpname, ".flo");
  1804. + #endif
  1805.         flow_dump_file = fopen (dumpname, "w");
  1806.         if (flow_dump_file == 0)
  1807.       pfatal_with_name (dumpname);
  1808. ***************
  1809. *** 1433,1439 ****
  1810. --- 1476,1486 ----
  1811.       {
  1812.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
  1813.         strcpy (dumpname, dump_base_name);
  1814. + #ifndef atarist
  1815.         strcat (dumpname, ".combine");
  1816. + #else
  1817. +       strcat (dumpname, ".cmb");
  1818. + #endif
  1819.         combine_dump_file = fopen (dumpname, "w");
  1820.         if (combine_dump_file == 0)
  1821.       pfatal_with_name (dumpname);
  1822. ***************
  1823. *** 1444,1450 ****
  1824. --- 1491,1501 ----
  1825.       {
  1826.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1827.         strcpy (dumpname, dump_base_name);
  1828. + #ifndef atarist
  1829.         strcat (dumpname, ".sched");
  1830. + #else
  1831. +       strcat (dumpname, ".sch");
  1832. + #endif
  1833.         sched_dump_file = fopen (dumpname, "w");
  1834.         if (sched_dump_file == 0)
  1835.       pfatal_with_name (dumpname);
  1836. ***************
  1837. *** 1455,1461 ****
  1838. --- 1506,1516 ----
  1839.       {
  1840.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1841.         strcpy (dumpname, dump_base_name);
  1842. + #ifndef atarist
  1843.         strcat (dumpname, ".lreg");
  1844. + #else
  1845. +       strcat (dumpname, ".lrg");
  1846. + #endif
  1847.         local_reg_dump_file = fopen (dumpname, "w");
  1848.         if (local_reg_dump_file == 0)
  1849.       pfatal_with_name (dumpname);
  1850. ***************
  1851. *** 1466,1472 ****
  1852. --- 1521,1531 ----
  1853.       {
  1854.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1855.         strcpy (dumpname, dump_base_name);
  1856. + #ifndef atarist
  1857.         strcat (dumpname, ".greg");
  1858. + #else
  1859. +       strcat (dumpname, ".grg");
  1860. + #endif
  1861.         global_reg_dump_file = fopen (dumpname, "w");
  1862.         if (global_reg_dump_file == 0)
  1863.       pfatal_with_name (dumpname);
  1864. ***************
  1865. *** 1477,1483 ****
  1866. --- 1536,1546 ----
  1867.       {
  1868.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 8);
  1869.         strcpy (dumpname, dump_base_name);
  1870. + #ifndef atarist
  1871.         strcat (dumpname, ".sched2");
  1872. + #else
  1873. +       strcat (dumpname, ".sc2");
  1874. + #endif
  1875.         sched2_dump_file = fopen (dumpname, "w");
  1876.         if (sched2_dump_file == 0)
  1877.       pfatal_with_name (dumpname);
  1878. ***************
  1879. *** 1488,1494 ****
  1880. --- 1551,1561 ----
  1881.       {
  1882.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1883.         strcpy (dumpname, dump_base_name);
  1884. + #ifndef atarist
  1885.         strcat (dumpname, ".jump2");
  1886. + #else
  1887. +       strcat (dumpname, ".jp2");
  1888. + #endif
  1889.         jump2_opt_dump_file = fopen (dumpname, "w");
  1890.         if (jump2_opt_dump_file == 0)
  1891.       pfatal_with_name (dumpname);
  1892. ***************
  1893. *** 1512,1518 ****
  1894. --- 1579,1589 ----
  1895.       {
  1896.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
  1897.         strcpy (dumpname, dump_base_name);
  1898. + #ifndef atarist
  1899.         strcat (dumpname, ".stack");
  1900. + #else
  1901. +       strcat (dumpname, ".stk");
  1902. + #endif
  1903.         stack_reg_dump_file = fopen (dumpname, "w");
  1904.         if (stack_reg_dump_file == 0)
  1905.       pfatal_with_name (dumpname);
  1906. ***************
  1907. *** 2506,2517 ****
  1908. --- 2577,2598 ----
  1909.     int version_flag = 0;
  1910.     char *p;
  1911.   
  1912. + #ifdef atarist
  1913. + /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  1914. + /*  _malloczero(1); */     /* zero mallocs by default */
  1915. + #endif  
  1916.     /* save in case md file wants to emit args as a comment.  */
  1917.     save_argc = argc;
  1918.     save_argv = argv;
  1919.   
  1920.     p = argv[0] + strlen (argv[0]);
  1921. + #ifndef atarist
  1922.     while (p != argv[0] && p[-1] != '/') --p;
  1923. + #else
  1924. +   while (p != argv[0] && ( ((p[-1] != '/') || (p[-1] != '\\')) &&
  1925. +               (p[-2] != ':') ) ) --p;
  1926. + #endif
  1927.     progname = p;
  1928.   
  1929.   #ifdef RLIMIT_STACK
  1930. ***************
  1931. *** 2528,2534 ****
  1932. --- 2609,2617 ----
  1933.   
  1934.     signal (SIGFPE, float_signal);
  1935.   
  1936. + #ifndef atarist
  1937.     signal (SIGPIPE, pipe_closed);
  1938. + #endif
  1939.   
  1940.     decl_printable_name = decl_name;
  1941.     lang_expand_expr = (struct rtx_def *(*)()) do_abort;
  1942. ***************
  1943. *** 2614,2619 ****
  1944. --- 2697,2712 ----
  1945.         else if (!strcmp (str, "dumpbase"))
  1946.           {
  1947.             dump_base_name = argv[++i];
  1948. + #ifdef atarist
  1949. + /* dump_base_name will typically be 'foo.c' here.  Need to truncate at the '.',
  1950. +    cause dots mean something here */
  1951. +         {
  1952. +           char * n = dump_base_name;
  1953. +           for ( ; ((*n) && (*n != '.')) ; )
  1954. +         n++;
  1955. +           *n = '\0';
  1956. +         }
  1957. + #endif
  1958.           }
  1959.         else if (str[0] == 'd')
  1960.           {
  1961. ***************
  1962. *** 2990,2996 ****
  1963. --- 3083,3095 ----
  1964.        option flags in use.  */
  1965.     if (version_flag)
  1966.       {
  1967. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  1968. + #include "PatchLev.h"
  1969. +         fprintf (stderr, "%s version %s-atariST Patchlevel %s",
  1970. +          language_string, version_string, PatchLevel);
  1971. + #else
  1972.         fprintf (stderr, "%s version %s", language_string, version_string);
  1973. + #endif
  1974.   #ifdef TARGET_VERSION
  1975.         TARGET_VERSION;
  1976.   #endif
  1977. ***************
  1978. *** 3011,3016 ****
  1979. --- 3110,3117 ----
  1980.   
  1981.     compile_file (filename);
  1982.   
  1983. + #if (!(defined(atarist) || defined(atariminix)))
  1984. + #if (!(defined(CROSSHPUX)))
  1985.   #ifndef VMS
  1986.     if (flag_print_mem)
  1987.       {
  1988. ***************
  1989. *** 3027,3032 ****
  1990. --- 3128,3135 ----
  1991.   #endif /* not USG */
  1992.       }
  1993.   #endif /* not VMS */
  1994. + #endif
  1995. + #endif
  1996.   
  1997.     if (errorcount)
  1998.       exit (FATAL_EXIT_CODE);
  1999. ***************
  2000. *** 3138,3140 ****
  2001. --- 3241,3274 ----
  2002.   
  2003.     fprintf (stderr, "\n");
  2004.   }
  2005. + #ifdef atarist
  2006. + void atari_output_filename(file, filename)
  2007. + FILE *file;
  2008. + char *filename;
  2009. + {
  2010. +     if( (!file) || (!filename) ) return;
  2011. +     for(; *filename; filename++)
  2012. +     {
  2013. +     if(*filename == '\\') putc('\\', file);
  2014. +     putc(*filename, file);
  2015. +     }
  2016. + }
  2017. + #include <string.h>
  2018. + char *atari_filename_nondirectory(p)
  2019. + char *p;
  2020. + {
  2021. +     char *s;
  2022. +     
  2023. +     for(s = p + strlen(p); s != p; --s)
  2024. +     {
  2025. +     if((*s == '/') || (*s == '\\'))
  2026. +         break;
  2027. +     }
  2028. +     
  2029. +     return (s == p) ? p : s+1;
  2030. + }
  2031. + #endif
  2032.